const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sys_sms', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    tenantId: {
      type: DataTypes.STRING(12),
      allowNull: true,
      defaultValue: "000000",
      comment: "租户ID",
      field: 'tenant_id'
    },
    category: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "分类"
    },
    smsCode: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "资源编号",
      field: 'sms_code'
    },
    templateId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "模板ID",
      field: 'template_id'
    },
    accessKey: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "accessKey",
      field: 'access_key'
    },
    secretKey: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "secretKey",
      field: 'secret_key'
    },
    regionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "regionId",
      field: 'region_id'
    },
    signName: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "短信签名",
      field: 'sign_name'
    },
    remark: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "备注"
    },
    createUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'create_user'
    },
    createDept: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建部门",
      field: 'create_dept'
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'create_time'
    },
    updateUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "修改人",
      field: 'update_user'
    },
    updateTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "修改时间",
      field: 'update_time'
    },
    status: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "状态"
    },
    isDeleted: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0,
      comment: "是否已删除",
      field: 'is_deleted'
    }
  }, {
    sequelize,
    tableName: 'sys_sms',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
